package com.recommend.controller;

import com.dps.recommend.beans.DpsDataResult;
import com.dps.recommend.beans.DpsRequest;
import com.dps.recommend.process.DpsRecProcessor;
import com.recommend.entity.Test;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/recommend")
public class HelloWorldController {

    @Autowired
    private DpsRecProcessor dpsRecProcessor;


    @PostMapping("/hello")
    public DpsDataResult index(@RequestBody Test req) {
        DpsRequest dpsRequest = new DpsRequest(req);
        dpsRequest.getRequest().setSence("sameSquare");
        List list = dpsRecProcessor.process(dpsRequest);
        DpsDataResult dpsDataResult = DpsDataResult.successWithData(list);
        return dpsDataResult;
    }
}